无法在xml配置文件的整数属性中解析java Spring EL
我试图在XML配置中使用Spring EL:从现有的beans ConfigProp创建具有队列容量的任务执行器
<task:executor id="executorWithPoolSizeRange"
pool-size="#{ConfigProp.async.corePoolSize}-#{ConfigProp.async.maxPoolSize}"
queue-capacity="#{ConfigProp.async.queueCapacity}"/>
从Intellij的思想来看,它表明pool-size
可以正确解析,但对于queue-capacity
来说,它不是整数类型
创意投诉信息
Cannot convert string #{ConfigProp.async.queueCapacity} to target class java.lang.Integer"
使用Tomcat运行时的执行日志
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 129 in XML document from ServletContext resource [/WEB-INF/dispatcher-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 129; columnNumber: 69; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'task:executor'.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:402) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
我做错了什么,或者SpringEL不支持这一点
# 1 楼答案
我可以手动创建
ThreadPoolTaskExecutor
bean,但它仍然不能回答我的问题